#!/bin/bash

# 原始字符串
OLD_MESSAGE="$1"
# 新字符串
NEW_MESSAGE="$2"

GIT_FILTER_REPO_PATH="./git_filter_repo.py"
# 运行 git-filter-repo 进行提交修改
python3 "$GIT_FILTER_REPO_PATH" --refs test..master --blob-callback "
    if b'$OLD_MESSAGE' in blob.data:
        blob.data = blob.data.replace(b'$OLD_MESSAGE', b'$NEW_MESSAGE')
"

# python3 "$GIT_FILTER_REPO_PATH" --refs HEAD~2..master --message-callback "$MESSAGE_CALLBACK"

# 内容替换
# sh modifyContent.sh "test" "test1"